package log

import (
	"fmt"

	"good.house/config"
)

func SetupLog(cfg *config.Config) {
	var configure = Configure{
		Appenders: map[string]Appender{
			"console": {
				Type: Console,
			},
			"file": {
				Type:     DateFile,
				FileName: fmt.Sprintf("%s/%s", cfg.Log.LogPath, "gin-request.log"),
			},
		},
		Categories: map[string]Category{
			"fileAndConsole": {
				Appenders: []string{"console", "file"},
				Leval:     Info,
			},
		},
	}

	// 初始化log
	ConfigureLog(configure)
}
